package com.wangtao.nio;


import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.nio.channels.FileChannel;

public class NIOFileChannel02 {

    public static void main(String[] args) throws IOException {
        FileInputStream fileInputStream = new FileInputStream("D:\\1.jpg");

        FileOutputStream fileOutputStream = new FileOutputStream("D:\\2.jpg");

        FileChannel f1 = fileInputStream.getChannel();

        FileChannel f2 = fileOutputStream.getChannel();

        f1.transferTo(0, f1.size(),f2);

        f1.close();
        f2.close();
        fileInputStream.close();
        fileOutputStream.close();
    }
}
